#Twisted Shootout
#Copyright (C) 2007 Han Dao
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

#You can contact the author at wikipediankiba@gmail.com
import pygame
class StartDisplay:
	def __init__(self,engine,sel):
		self.engine = engine
		self.sel = sel
		self.mode = 1
		self.object = pygame.Rect(0,0,80,60)
		self.pos = pygame.Rect(self.engine.obj[1][0],self.engine.obj[1][1],80,60)
		self.begin = 0
	def roll(self):
		rows = 0
		columns = 0
		n = 0
		while True:
			a = columns * 80 + self.engine.position.move
			b = rows * 60 + self.engine.position.height
			self.object.x = a
			self.object.y = b
			self.determine(n)
			columns = columns + 1
			n = n + 1
			if columns == 30:
				rows = rows + 1
				columns = 0
			if rows == 30:
				return
	def determine(self,n):
		if self.object.colliderect(self.pos):
			self.activate(n)
			self.begin = n
	def activate(self,n):
		self.engine.mapobj[n].image = self.sel.start.image